{include file="public/header"}
<body>
<style>
    .select-item span{
        font-size: 32px;
    }
    .layui-form-label{
        width: 200px;
    }
    .layui-input{
        width:70%;
    }
</style>

<fieldset class="layui-elem-field">
    <legend><span style="color: #58a;">文字素材添加</span></legend>
    <div class="layui-field-box">
        <button onclick="window.history.go(-1);" class="layui-btn layui-btn-normal"><i class="layui-icon"></i> 返回</button>

        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">模板名称</label>
                <div class="layui-input-block">
                    <input type="text" name="title" required value="" lay-verify="required" placeholder="标题十个字左右最佳" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">文本内容</label>
                <div class="layui-input-block">
                    <textarea name="content" style="width: 70%;" placeholder="请输入内容" class="layui-textarea"></textarea>
                </div>
            </div>


            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="admin-form">立即提交</button>
                </div>
            </div>
        </form>
    </div>
</fieldset>

{include file="public/footer"}
<script>
    //表单提交事件
    layui.use('form', function(){
        var form = layui.form();
        form.on('submit(admin-form)', function(data){
            var params  = {
                url : "{:url('addWriting')}",
                data: data.field,
                type: 'post',
                sCallback:function(res){
                    layer.msg(res.msg,{time:1800},function(){
                        window.location.href = "{:url('index')}"
                    });
                }
            };
            common.request(params);
            return false;
        });

    });
</script>
</body>
</html>